import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './vuex/store';
import axios from "@/utils/axios";
import './registerServiceWorker';
import '@/utils/axios';
import 'reset-css';
import '@/apis';
import '@/assets/css/font-awesome.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
import '@/mixins/mixins'
//将axios注册成为全局属性，可以通过this.$http发起请求

Vue.config.productionTip = false
router.beforeEach ((to,from,next)=>{
  if(to.path==='/Signin'){
    localStorage.clear();
    next();
  }else{
    if(localStorage.getItem('token')){
      next();
    }else{
      next({path:'/Signin',query:{redirect:to.path}})
    }
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
